<?php
/**
 * Project: firework-cms             >>  http://firework-cms.googlecode.com
 * Authors: YouniS Ben Salah  (-.-)  >>  http://younishd.kegtux.org
 *          Fabien Wang       (^.^)  >>  http://fabienwang.fr
 * License: See README and LICENSE in the top level directory
 */
 
/*************************************************************/
/* THIS DOCUMENT INFORMS ABOUT NAMING AND CODING CONVENTIONS */
/*************************************************************/

 
/**
 * Project:
 * this for file doc
 * ...
 */
require_once 'foo.php';
// a normal comment - usually to explain a mechanism. not for doc!
/* don't use this for single line */
/** this for file, class, or function doc */
 
 
// function convs
// the function name begins with lowercase,
// no underscore _ and words are separated with Upcase
// like this doSomething() screwThatShit() firework() dafuqDidIJustRead() etc...
 
/**
 * function description goes here ...
 * returns value
 * etc...
 */
function fireworkThis( $foo, $bar )
{
    echo 'a text between hard quotes, no parenthesis for echo, require* include* etc...';
    // curly brackets are opened and closed on new lines.
    // code goes here ..
}
 
 
// class convs
// just like functions, both curly brackets are on a new line.
// class name is like function name, but starts with upcase
// MyStuff Hell GreenYellowBird ApplePie ...

class MyFirework
{
    // ctor
    public function __construct()
    {
        // code goes here ...
    }

    // dtor
    public function __destruct()
    {
      // code goes here ...
    }

    // always leave 2 newlines

    // protected attributes ( member variables ) here
    // attributes and normal variables convs
    // consts are WRITTEN_IN_UPCASE like php standard consts.
    protected $stuff;
    protected $other_stuff = 'shit';    

    // methods ( member functions )
    /**
     * function doc here...
     * doStuff()
     * returns etc...
     * ...
     */
    public function doStuff()
    {
        // if, while, for, try...
        if ( 120 < 12 or goToHell() ) {
            // if stuff
        }
        else if ( youLie() == -1 ) {
            // else if stuff
        }
        else {
            // else stuff
        }
    
    
    
    while ( $you->getRelStat() == 'single' ) {
      searchForDevices();
    }
    
    
    
    for ( $i=0; $i<LIMIT; $i++ ) {
      // do stuff LIMIT times.
    }
    
    switch ( $animal ) {
        case 'deer' :
            echo 'deer runs too fast.';
            break;
        case 'elephant' :
            echo '...irrelephant';
            break;
        case 'penguin' :
            echo 'penguins are great.';
            break;
        case 'whale' :
            echo 'a whale is k too.';
            break;
        default :
            echo 'you are a monkey.';
    }
    
    
    try
    {
      // code that handles exceptions goes here...
    }
    catch ( Exception $e )
    {
        die( 'error: '. $e-getMessage() );
    }

     
    // calling function with multiple parameters
    // convs: no space between function name and opening parenthese, but space between the two parenthesis.
    // it's a lot clearer
    drinkCoffee( 3, 'much milk' );
     
    // calling function with single parameter
    eatFood( 'lasagne' );
     
    // is k too. when it's a single parameter it's not important to put space.
    addMoney(10);
     
    // calling function without any parameters
    // obvious. wrote this for completeness sake. ^^
    burnInHell();
    
  }

}

/* don't use ?> in php-only files like class files */
?>
